<template>
  <div id="app">
    <HelloWorld msg="Welcome to Your Vue.js App"/>


  </div>
</template>

<script>
import HelloWorld from './components/HelloWorld.vue'
export default {
  name: 'App',
  components: {
    HelloWorld
  },
  mounted() {
    fetch('http://192.168.1.146:8081/test/getMessage',{
      method:'POST'
    })
        .then((data) => {
            return data.json()
        })
        .then((ret) => {
          this.$bus.$emit('breathData',ret);
        })
        .catch(e => {
          console.log(e)
        })
    // let webSocket = new WebSocket('ws://127.0.0.1:8081');
    // webSocket.onmessage = e => {
    //   console.log(`收到数据，长度为：${JSON.parse(e.data).length}`)
    //   this.$bus.$emit('breathData',JSON.parse(e.data));
    // }
  }
}
</script>

<style>
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  margin-top: 60px;
}
</style>
